<template>
  <div>
    <!-- 面包屑 -- 公共组件-->
    <v-breadcrumb></v-breadcrumb>
    <!-- 添加按钮 -->
    <el-button type="primary" plain size="small" class="m20" @click="add">添加</el-button>
    <!-- 菜单列表组件 -->
    <v-list @edit="edit"></v-list>
    <!-- 弹框组件-->
    <v-dialog :isshow="isshow" :isadd="isadd" @cancel="cancel" ref="dialog"></v-dialog>
  </div>
</template>
  
  <script>
import vList from "./list.vue";
import vDialog from "./dialog.vue";
export default {
  components: {
    vList,
    vDialog,
  },
  data(){
    return {
        isshow:false,
        isadd:false, //true:添加，  false：编辑
    }
  },
  methods:{
    //1.点击添加按钮
    add(){
        this.isshow = true; //显示弹框
        this.isadd = true; //显示添加标题
    },
    //2.关闭弹框
    cancel(){
        this.isshow = false
    },
    //3.点击编辑
    edit(id){
        this.isshow = true; //显示弹框
        this.isadd = false; //显示编辑标题

        //调用子组件的数据 -- ref
      this.$refs.dialog.lookup(id);
    }
  }
};
</script>
  
  <style>
</style>